package Factory;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: Bjarke
 * Date: 16-10-13
 * Time: 18:57
 * To change this template use File | Settings | File Templates.
 */
public class EnemyShipTesting {

    public static void main(String[] args){

        /**
         * How to use factory
         */
        EnemyShipFactory shipFactory = new EnemyShipFactory();

        EnemyShip theEnemy = null;

        Scanner userInput = new Scanner(System.in);

        System.out.println("What type of ship? (U / R / B) ");

        if (userInput.hasNextLine()){

            String typeOfShip = userInput.nextLine();

            theEnemy = shipFactory.makeEnemyShip(typeOfShip);
        }

        if (theEnemy != null){
            doStuffEnemy(theEnemy);
        } else System.out.println("Enter U, R or B next time");


        /**
         * How not to do things
         */
        /*
        EnemyShip theEnemy = null;

        Scanner userInput = new Scanner(System.in);

        String enemyShipOption = " ";

        System.out.println("What type of ship U/R?");

        if (userInput.hasNextLine()){
            enemyShipOption = userInput.nextLine();
        }

        if (enemyShipOption.equals("U")){
            theEnemy = new UFOEnemyShip();
        } else {
            if (enemyShipOption.equals("R")){
                theEnemy = new RocketEnemyShip();
            }
        }
        doStuffEnemy(theEnemy);
        */
    }

    public static void doStuffEnemy(EnemyShip anEnemyShip){

        anEnemyShip.displayEnemyShip();
        anEnemyShip.followHeroShip();
        anEnemyShip.enemyShipShoots();
    }
}
